home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / midas060 / src / xm.h < prev   
Encoding:
C/C++ Source or Header  |  1997-01-16  |  6.8 KB  |  185 lines

  1. /*      XM.H
  2.  *
  3.  * Fasttracker 2 eXtended Module format structures
  4.  *
  5.  * $Id: xm.h,v 1.4 1997/01/16 18:41:59 pekangas Exp $
  6.  *
  7.  * Copyright 1996,1997 Housemarque Inc.
  8.  *
  9.  * This file is part of the MIDAS Sound System, and may only be
  10.  * used, modified and distributed under the terms of the MIDAS
  11.  * Sound System license, LICENSE.TXT. By continuing to use,
  12.  * modify or distribute this file you indicate that you have
  13.  * read the license and understand and accept it fully.
  14. */
  15.  
  16.  
  17. #ifndef __XM_H
  18. #define __XM_H
  19.  
  20.  
  21. /****************************************************************************\
  22. *       enum xmFlags
  23. *       ------------
  24. * Description:  Flag bits for different flag bytes and words in the XM
  25. *               file
  26. \****************************************************************************/
  27.  
  28. enum xmFlags
  29. {
  30.     xmLinearFreq = 1,                   /* xmHeader: linear frequency table
  31.                                            used */
  32.     xmEnvelopeOn = 1,                   /* xmInstSampleHeader: envelope on */
  33.     xmEnvelopeSustain = 2,              /* envelope sustain on */
  34.     xmEnvelopeLoop = 4,                 /* envelope loop on */
  35.  
  36.     xmSample16bit = 16                  /* xmSampleHeader: 16-bit sample */
  37. };
  38.  
  39.  
  40.  
  41.  
  42. /****************************************************************************\
  43. *       struct xmHeader
  44. *       ---------------
  45. * Description:  Extended Module file header
  46. \****************************************************************************/
  47.  
  48. typedef struct
  49. {
  50.     char        signature[17];          /* "Extended Module: " */
  51.     char        name[20];               /* module name */
  52.     uchar       num1A;                  /* 0x1A */
  53.     char        trackerName[20];        /* tracker name */
  54.     U16         version;                /* version number, major-minor */
  55.     U32         hdrSize;                /* header size */
  56.     U16         songLength;             /* song length */
  57.     U16         restart;                /* restart position */
  58.     U16         numChans;               /* number of channels */
  59.     U16         numPatts;               /* number of patterns */
  60.     U16         numInsts;               /* number of instruments */
  61.     U16         flags;                  /* header flags, see enum
  62.                                            xmFlags */
  63.     U16         speed;                  /* initial speed */
  64.     U16         tempo;                  /* initial tempo */
  65.     uchar       orders[256];            /* pattern order table */
  66. } xmHeader;
  67.  
  68.  
  69.  
  70.  
  71. /****************************************************************************\
  72. *       struct xmPattern
  73. *       ----------------
  74. * Description:  Fasttracker 2 Extended Module pattern
  75. \****************************************************************************/
  76.  
  77. typedef struct
  78. {
  79.     U32         headerLength;           /* pattern header length */
  80.     U8          packType;               /* packing type (now 0) */
  81.     U16         numRows;                /* number of rows */
  82.     U16         pattDataSize;           /* pattern data size */
  83.     uchar       data[EMPTYARRAY];       /* packed pattern data */
  84. } xmPattern;
  85.  
  86.  
  87.  
  88.  
  89. /****************************************************************************\
  90. *       struct xmInstHeader
  91. *       -------------------
  92. * Description:  Fasttracker 2 Extended Module instrument file header
  93. \****************************************************************************/
  94.  
  95. typedef struct
  96. {
  97.     U32         instSize;               /* instrument size */
  98.     char        instName[22];           /* instrument filename */
  99.     U8          instType;               /* instrument type (now 0) */
  100.     U16         numSamples;             /* number of samples in instrument */
  101. } xmInstHeader;
  102.  
  103.  
  104.  
  105. /****************************************************************************\
  106. *       struct xmInstSampleHeader
  107. *       -------------------------
  108. * Description:  Fasttracker 2 Extended Module instrument sample header
  109. *               (follows instrument header if the instrument has samples.
  110. *               Only once per instrument!)
  111. \****************************************************************************/
  112.  
  113. typedef struct
  114. {
  115.     U32         headerSize;             /* sample header size */
  116.     U8          noteSmpNums[96];        /* sample numbers for notes */
  117.     U8          volEnvelope[48];        /* volume envelope points */
  118.     U8          panEnvelope[48];        /* panning envelope points */
  119.     U8          numVolPoints;           /* number of volume envelope points */
  120.     U8          numPanPoints;           /* number of panning env. points */
  121.     U8          volSustain;             /* volume sustain point */
  122.     U8          volLoopStart;           /* volume loop start point */
  123.     U8          volLoopEnd;             /* volume loop end point */
  124.     U8          panSustain;             /* panning sustain point */
  125.     U8          panLoopStart;           /* panning loop start point */
  126.     U8          panLoopEnd;             /* panning loop end point */
  127.     U8          volEnvFlags;            /* volume envelope flags */
  128.     U8          panEnvFlags;            /* panning envelope flags */
  129.  
  130.     U8          vibType;                /* vibrato type */
  131.     U8          vibSweep;               /* vibrato sweep */
  132.     U8          vibDepth;               /* vibrato depth */
  133.     U8          vibRate;                /* vibrato rate */
  134.     U16         volFadeout;             /* volume fadeout */
  135.     U16         reserved;
  136. } xmInstSampleHeader;
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143. /****************************************************************************\
  144. *       struct xmSampleHeader
  145. *       ---------------------
  146. * Description:  Fasttracker 2 Extended Module sample file header
  147. \****************************************************************************/
  148.  
  149. typedef struct
  150. {
  151.     U32         smpLength;              /* sample length */
  152.     U32         loopStart;              /* loop start */
  153.     U32         loopLength;             /* loop length */
  154.     U8          volume;                 /* volume */
  155.     S8          finetune;               /* finetune */
  156.     U8          flags;                  /* sample flags, bits 0-1 are loop
  157.                                            type: 0 = no loop, 1 = unidir,
  158.                                            2 = bidir loop */
  159.     U8          panning;                /* sample panning */
  160.     S8          relNote;                /* relative note number */
  161.     U8          reserved;
  162.     char        smpName[22];            /* sample name */
  163.     /* Sample data follows, in delta format */
  164. } xmSampleHeader;
  165.  
  166.  
  167.  
  168. #endif
  169.  
  170.  
  171. /*
  172.  * $Log: xm.h,v $
  173.  * Revision 1.4  1997/01/16 18:41:59  pekangas
  174.  * Changed copyright messages to Housemarque
  175.  *
  176.  * Revision 1.3  1996/05/24 17:02:08  pekangas
  177.  * Fixed to work with Watcom C again - using EMPTYARRAY
  178.  *
  179.  * Revision 1.2  1996/05/24 16:20:36  jpaana
  180.  * Fixed for Linux
  181.  *
  182.  * Revision 1.1  1996/05/22 20:49:33  pekangas
  183.  * Initial revision
  184.  *
  185. */